// ActionScript file
import com.helloniu.controller.UserListController;
import com.helloniu.fl.util.StyleTool;
import com.helloniu.fl.util.Tool;
import com.helloniu.red5.info.UserInfo;

private var playVideoW:Number = 330;
private var playVideoH:Number = 260;
private var playUserID:String = null;

private function initApp(e:*):void {
	playVideoBtn.enabled = false;    
    StyleTool.setBtnStyle(playVideoBtn, "openVideoIcon");
    StyleTool.setBtnSStyle(playVideoBtn, "closeVideoIcon");
}

public function setPlayUserID(aplayUserID:String):void {
	playUserID = aplayUserID;
	playVideoBtn.enabled = playUserID != null;
}

public function getPlayUserID():String {
	return this.playUserID;
}

private function playVideo(e:*):void {    
	if(playUserID == null) {
    	return;
    }

	if(!playVideoBtn.selected) {
       	UserListController.getIns().closePlayVideo(playUserID);
    	return;
    }

	playVideoW = this.width;//110
	playVideoH = this.height;//110
	
	vdShow.width = playVideoW;
	vdShow.height = playVideoH;
    
	var video:Video = UserListController.getIns().createPlayVideo(playUserID);
	video.width = playVideoW;
	video.height = playVideoH;	

	vdShow.addChild(video);
}

private function videoChange(e:*):void {
	if(videoSel.selectedItem.data is UserInfo) {
	    setPlayUserID(videoSel.selectedLabel);
	}	
}
